﻿@model LetLord.Models.Tenant
@*<script src="~/Scripts/jquery-1.9.1.min.js"></script>*@
<div class="row-fluid">
    @if (Model.TenantGroupMembers.Count == 0)
    {
        <h3>You're not representing a group! If you are, <a href="#" id="showModal" role="button" data-toggle="modal">add members</a> now.</h3>                                                  
    }
    else
    {
        <div class="row-fluid">
            <h4>Tenants You Represent</h4>
            <hr />
        </div>
        foreach (var member in Model.TenantGroupMembers)
        {
        <div class="row-fluid">
            <div class="span7">
                @member.TenantGroupMemberName<text>, </text>
                @member.TenantGroupMemberAge
            </div>
            <div class="span5 pull-right">
                <div class="btn-group">
                    <button class="btn btn-primary edit-member" data-id="@member.TenantGroupMemberId">Edit</button>
                    @Ajax.ActionLink("Delete", "DeleteMember", "Tenants",
                new { id = member.TenantGroupMemberId },
                new AjaxOptions { InsertionMode = InsertionMode.Replace, HttpMethod = "POST", UpdateTargetId = "tenant-group-members", OnBegin = "return confirm(Are you sure you want to delete this member from your group?');" },
                new { @class = "btn btn-primary" })
                    <button class="btn btn-primary add-tgm" data-toggle="modal">Add another</button>
                </div>
            </div>
        </div>
        }
    }
</div>
<div class="modal hide fade in" id="create-tenant-group-member-modal" data-url="/Tenants/TenantGroupMembers">
    <div id="container"></div>
</div>
<div class="modal hide fade in" id="edit-member">
    <div id="edit-member-container"></div>
</div>

